<template>
  <div class="DingDingManage h-full bg-white">
    <a-button type="primary" @click="add" style="margin-bottom: 10px">新建</a-button>
    <a-table
      bordered
      :columns="columns"
      :data-source="tableData"
      :pagination="false"
    >
    </a-table>
  </div>
</template>

<script>
  import PageInitFn from '@/api/pageInitFn'
export default {
  name: 'DingDingManage',
  data () {
    return {
      activeKey: '1',
      showTabs: false,
      panes: [
        {
          title: '钉钉管理',
          content: '',
          key: '1',
          closable: false
        }
      ],
      currentComponent: 'ManageMain',
      columns: [
        {
          title: '名称',
          dataIndex: 'name',
          key: 'name',
          align: 'center'
        },
        {
          title: '环境类型',
          dataIndex: 'env',
          key: 'env',
          align: 'center'
        }
      ],
      tableData: []
    }
  },
  created () {
    this.pageInitFn = new PageInitFn(this)
    this.pageInitFn.created()
  },
  mounted () {
    this.pageInitFn.mounted(false)
  },
  methods: {
    add () {
      const _this = this
      this.$dialog({
        title: '新建',
        content: () => import('./dialog/AddDialog'),
        width: 600,
        centered: true,
        maskClosable: false,
        on: {
          ok (ctl) {
            const dialogCtl = ctl.getDialogCtl()
            const valid = dialogCtl.submit()
            if (valid) {
              _this.$router.push({
                name: _this.pageDetailRoute.routerName,
                query: {
                  title: dialogCtl.form.name
                }
              })
              ctl.closeDialog()
            }
          }
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
.DingDingManage{
  padding: 10px;
}
</style>
